home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / gfx / misc / PatchDT.lha / ROMCall.asm < prev    next >
Assembly Source File  |  1993-10-17  |  998b  |  43 lines

  1. *
  2. * ROMCall.asm - Fake call from ROM
  3. *
  4.  
  5.         SECTION text,CODE
  6.  
  7.         XDEF    _ROMCall,_InitROMCall
  8.  
  9. *
  10. * Find an RTS instruction somewhere in ROM.
  11. *
  12.  
  13. _InitROMCall:
  14.         lea     $01000000,a0
  15.         move.l  -$14(a0),d0                     ; Get ROM size
  16.         neg.l   d0
  17.         lea     0(a0,d0.l),a1                   ; Pointer to start of ROM
  18. loop:   cmp.w   #$4e75,(a1)+
  19.         bne.s   loop                            ; Maybe we should check that we
  20.                                                 ; don't search past the end of
  21.                                                 ; ROM here, but there should
  22.                                                 ; really be an RTS *somewhere* in
  23.                                                 ; ROM.
  24.         subq.l  #2,a1
  25.         move.l  a1,_ROMRTS(a4)
  26.         rts
  27.  
  28. *
  29. * Fake a ROM call
  30. *
  31.  
  32. _ROMCall:
  33.         move.l  _ROMRTS(a4),-(a7)
  34.         jmp     (a5)
  35.  
  36.         SECTION __MERGED,BSS
  37.  
  38.         XDEF    _ROMRTS
  39.  
  40. _ROMRTS: ds.l    1
  41.  
  42.         END
  43.